home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJEMU106.ARJ / E54.CC < prev    next >
C/C++ Source or Header  |  1991-04-25  |  779b  |  48 lines

  1. #include "emu.h"
  2. #include "rmov.h"
  3. #include "compare.h"
  4.  
  5. void emu_54()
  6. {
  7.   if (empty())
  8.     return;
  9.   if (modrm > 0277)
  10.   {
  11.     // fucom st(i)
  12.     if (empty(modrm&7))
  13.     {
  14.       setcc(SW_C3|SW_C2|SW_C0);
  15.       return;
  16.     }
  17.     int c = compare(st(), st(modrm&7));
  18.     int f;
  19.     if (c & COMP_SNAN)
  20.     {
  21.       exception(EX_I);
  22.       f = SW_C3 | SW_C2 | SW_C0;
  23.     }
  24.     else
  25.       switch (c)
  26.       {
  27.         case COMP_A_LT_B:
  28.           f = SW_C0;
  29.           break;
  30.         case COMP_A_EQ_B:
  31.           f = SW_C3;
  32.           break;
  33.         case COMP_A_GT_B:
  34.           f = 0;
  35.           break;
  36.         case COMP_NOCOMP:
  37.           f = SW_C3 | SW_C2 | SW_C0;
  38.           break;
  39.       }
  40.     setcc(f);
  41.     
  42.   }
  43.   else
  44.   {
  45.     emu_bad();
  46.   }
  47. }
  48.